!(function(w){
	var obj = {
		messageBox:function(t,m,callback){
			if(this.box == null){
				var div = document.createElement("div");
				div.id = "tipModal";
				this.set(div,"class","modal fade ");
				this.set(div,"tabindex",-1);
				this.set(div,"role","dialog");
				this.set(div,"aria-labelledby","mySmallModalLabel");
				this.set(div,"aria-hidden",true);
				var div2 = document.createElement("div");
				this.set(div2,"class","modal-dialog modal-lg");
				this.div2 = div2;	
				var divcontent = document.createElement("div");
				this.set(divcontent,'class','modal-content');		
				var divheader = document.createElement("div");
				var h4 = document.createElement("h4");
				this.set(h4,'class','modal-title');
				this.set(h4,'id','mySmallModalLabel');
				h4.innerHTML = t;
				var btn = document.createElement('button');
				this.set(btn,'type','button');
				this.set(btn,'class','close');
				this.set(btn,'data-dismiss','modal');
				this.set(btn,'aria-label','Close');
				var sp = document.createElement("span");
				this.set(sp,'aria-hidden','true');
				sp.innerHTML='×';
				btn.appendChild(sp);
				divheader.appendChild(btn);
				divheader.appendChild(h4);
				this.set(divheader,'class','modal-header');
				var div3 = document.createElement("div");
				this.set(div3,"class","modal-body"); 
				this.div3 = div3;
				div2.appendChild(div3);
				div.appendChild(div2);
				divcontent.appendChild(divheader);
				divcontent.appendChild(div3)
				div2.appendChild(divcontent);
				this.box = div;
				var that  = this;
				$(this.box).on('hidden.bs.modal', function (e) {
					that.box.remove();
					if(typeof callback === 'function'){
						callback.call(that);
					}	
				});
			}
			this.setTitleMessage(t,m);
			w.document.body.appendChild(this.box);
			$(this.box).modal('show');
		},
		set:function(a,b,c){
			a.setAttribute(b,c);
		},
		setTitleMessage:function(t,m){

			this.div3.innerHTML = m;
		},
		div2:null,
		div3:null,
		box:null,

	}
	w.messageBox = function(t,m,callback){
		obj.messageBox(t,m,callback);
	}
})(window)

